//
//  LTView.m
//  UI10_作业
//
//  Created by dllo on 16/6/17.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "LTView.h"

@implementation LTView

- (instancetype)initWithFrame:(CGRect)frame Text:(NSString *)text TextField:(NSString *)tField;
{
    self = [super initWithFrame:frame];
    if (self) {
        
        [self createSubView];
        self.label.text = text;
        self.textField.text = tField;
    }
    return self;
}

- (void)createSubView{
    self.label = [[UILabel alloc] initWithFrame:CGRectMake(20, 0, 80, 40)];
    self.label.backgroundColor = [UIColor redColor];
    [self addSubview:_label];
    [_label release];
    
    self.textField = [[UITextField alloc] initWithFrame:CGRectMake(self.label.frame.origin.x + self.label.frame.size.width + 10, 0, 200, 40)];
    self.textField.delegate = self;
    self.textField.backgroundColor = [UIColor greenColor];
    [self addSubview:_textField];
    [_textField release];
 
}

- (BOOL)textFieldShouldReturn:(UITextField *)textField{
    return [textField resignFirstResponder];
}
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    [self endEditing:YES];
}
@end
